package by.gravity.billprinter;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import by.gravity.billprinter.view.TouchImageView;

import com.nostra13.universalimageloader.core.ImageLoader;

public class TouchImageViewActivity extends Activity {

	public static final String IMAGE_PATH = "IMAGE_PATH";

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.a_image);
		TouchImageView img = (TouchImageView) findViewById(R.id.img);
		ImageLoader.getInstance().displayImage("file:/" + getIntent().getStringExtra(IMAGE_PATH), img);

		View cancelButton = findViewById(R.id.cancel);
		cancelButton.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				finish();
			}
		});

		View printButton = findViewById(R.id.print);
		printButton.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent intent = new Intent();
				intent.putExtra(IMAGE_PATH, getIntent().getStringExtra(IMAGE_PATH));
				setResult(RESULT_OK, intent);
				finish();
			}
		});
	}
}